"use strict";
cc._RF.push(module, '1af62bsY2lJaYMiUlGFyAkw', 'overclear');
// script/overclear.js

'use strict';

cc.Class({
	extends: cc.Component,

	properties: {
		overtop: cc.Node,
		cleartop: cc.Node,
		retry: cc.Node,
		next: cc.Node
	},

	onLoad: function onLoad() {
		var _this = this;

		cc.director.on('overclear', function (e) {
			if (e.detail.type == 'over') {
				//游戏结束
				_this.overtop.active = true;
				_this.cleartop.active = false;
				_this.next.active = false;
				_this.retry.active = true;
			} else {
				//clear 通关
				_this.overtop.active = false;
				_this.cleartop.active = true;
				_this.next.active = true;
				_this.retry.active = false;
			}
		}, this);
	},
	btnClick: function btnClick(event, customData) {
		var _this2 = this;

		switch (customData) {
			case 'retry':
				//重试本关
				cc.director.emit('ongame', 'restart');
				this.node.active = false;
				break;
			case 'next':
				//下一关
				cc.director.emit('ongame', 'next');
				this.node.active = false;
				break;
			case 'top':
				//回到主界面
				//cc.director.emit('ongame','endcurrent');
				//此处应该用渐隐效果
				cc.director.getScheduler().schedule(function () {
					_this2.node.opacity -= 5;
				}, this, 1 / 51, 50);

				cc.director.loadScene('main');

				//this.node.active = false;
				cc.director.emit('returntomain');
				break;
			default:
				break;
		}
	}
}

// update (dt) {},
);

cc._RF.pop();